package com.caocao.controller;

import com.caocao.service.CommonService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 描述:公共数据字段值获取控制器
 *
 * @Author:操文健
 * @Create Time:2017-09-15 20:09
 */
@RestController
@RequestMapping(value = "/common")
public class CommonCodeController {

    private static final Logger logger = LoggerFactory.getLogger(CommonCodeController.class);

    @Autowired
    CommonService commonService;

    @GetMapping(value = "/getCode")
    @ResponseBody
    public List<Map<String, Object>> getCodeMapForName(@RequestParam(value = "codeType")String codeType) {

        logger.info("根据CodeType进行查询相应的code值,对应的CodeTYpe为:" + codeType);
        return commonService.getCodeForName(codeType);
    }
}
